{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑段位</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">段位名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="el_name" lay-verify="required" placeholder="段位名称" class="layui-input" value="{$elInfo.el_name}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">经验值下限：</label>
                            <div class="layui-input-block">
                                <input type="text" name="el_min" lay-verify="required" placeholder="" class="layui-input" value="{$elInfo.el_min}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">经验值上限：</label>
                            <div class="layui-input-block">
                                <input type="text" name="el_max" lay-verify="required" placeholder="" class="layui-input" value="{$elInfo.el_max}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">等级：</label>
                            <div class="layui-input-block">
                                <input type="text" name="el_level" lay-verify="required" placeholder="" class="layui-input" value="{$elInfo.el_level}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">奖励金币数：</label>
                            <div class="layui-input-block">
                                <input type="text" name="el_price_score" lay-verify="required" placeholder="" class="layui-input" value="{$elInfo.el_price_score}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择优惠券：</label>
                            <div class="layui-input-block">
                                <select name="coupon_id" xm-select="select1" lay-verify="required" xm-select-radio="" xm-select-search="" xm-select-search-type="dl">
                                    {foreach name="couponList" item="v"}
                                    <option value="{$v.coupon_id}" {$v.coupon_id==$elInfo.el_price_coupon?'selected':''}>{$v.coupon_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <input type="hidden" name="el_id" value="{$elInfo.el_id}">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $.ajax({
                url:"{:url('dangradingEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Dangrading/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
</body>
</html>
